package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Product extends  BaseDomain{

    private String name;//商品名称

    private Integer integral;//积分

    private String coverUrl;//商品封面

    private Integer numberCase;//商品存货
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")

    private Date addTime;//商品添加时间

    private Long productTypeId;//品牌id

    private String productTypeName;//品牌名称

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("coverUrl",coverUrl);
        map.put("integral",integral);
        map.put("numberCase",numberCase);
        map.put("productTypeId",productTypeId);
        map.put("productTypeName",productTypeName);
        return JSONUtil.toJSONString(map);
    }

}